package io.renren.modules.erp.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.erp.dao.BusinessBillInfoDao;
import io.renren.modules.erp.entity.BusinessBillInfoEntity;
import io.renren.modules.erp.service.BusinessBillInfoService;


@Service("businessBillInfoService")
public class BusinessBillInfoServiceImpl extends ServiceImpl<BusinessBillInfoDao, BusinessBillInfoEntity> implements BusinessBillInfoService {

	@Autowired
	private BusinessBillInfoDao businessBillInfoDao;
	
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        Page<BusinessBillInfoEntity> page = this.selectPage(
                new Query<BusinessBillInfoEntity>(params).getPage(),
                new EntityWrapper<BusinessBillInfoEntity>()
        );

        return new PageUtils(page);
    }

	@Override
	public BusinessBillInfoEntity addBusinessBillInfo(BusinessBillInfoEntity businessBillInfoEntity) {
		businessBillInfoDao.addBusinessBillInfo(businessBillInfoEntity);
		return businessBillInfoEntity;
	}

	@Override
	public List<Map<String, Object>> queryBillInfoPage(Map<String, Object> params) {
		return businessBillInfoDao.queryBillInfoPage(params);
	}

	@Override
	public int updateTotalNumAndPrice(Long businessBillInfo) {
		return businessBillInfoDao.updateTotalNumAndPrice(businessBillInfo);
	}

}
